{extend name="../../admin/view/main"}

{block name="content"}
<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body">
        <div class="layui-form-item">
            <label class="layui-form-label">标题</label>
            <div class="layui-input-block">
                <input name="title" value='{$vo.title|default=""}' required placeholder="请输入标题名称" class="layui-input">
                <p class="help-block">必填，请填写标题名称（如：关于我们），建议字符不要太长，一般4-6个汉字</p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">缩略图</label>
            <div class="layui-input-block">
                <input type="hidden" name="thumb" value="{$vo.thumb|default=''}">
                <script>$('[name=thumb]').uploadOneImage()</script>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">内容</label>
            <div class="layui-input-block">
                <textarea name='content'>{$vo.content|default=""}</textarea>
            </div>
        </div>

        <div class="hr-line-dashed"></div>
        <input type='hidden' value='{$vo.catid}' name='catid'>
        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
        <div class="layui-form-item text-center">
            <button class="layui-btn" type='submit' lay-filter="saveData">保存数据</button>
            <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
        </div>
    </div>
</form>
{/block}


{block name='script'}
<script>
    require(['ckeditor'], function () {
        var editor;
        setTimeout(function () {
            if (editor) editor.destroy();
            editor = window.createEditor('[name="content"]');
        }, 100);
    });
</script>
{/block}